Field
This disclosure is generally related to databases. More specifically, this disclosure is related to a system for efficiently processing transactions requests to transfer funds to or from an account in a database.
Related Art
The progress of technology brings both an increasing convenience and risk to financial transactions. An accounting database can include information for multiple accounts, where funds may be transferred to and from an account by locking a corresponding record in the database. For example, a transaction request (e.g., to transfer funds into an account or to transfer funds out of an account) may include two main operations: generating a record of the request; and updating the balance on the account. To preserve the accuracy of the database while performing these operations, the record corresponding to the account may be locked upon receiving a transaction request, and may be automatically unlocked upon completion of the transaction request. The database may receive multiple transactions requests for one account at the same time. However, only one request or “thread” may hold the lock for the account at any given time. Other requests or threads must wait to obtain the lock, and the database can only perform the transaction requests on the account in a sequential manner. Thus, the account may become a “hotspot” account that creates a performance bottleneck for the database.